--[[	$Id: badBuffs.lua 3470 2013-08-09 18:57:44Z sdkyron@gmail.com $	]]

if not (caelLib.myChars or caelLib.herChars) then return end

local _, caelCore = ...

--[[	Auto cancel various buffs	]]

caelCore.badbuffs = caelCore.createModule("BadBuffs")

local GetSpellName = function(spellId)
	return GetSpellInfo(spellId)
end

local badBuffsList = {
	[GetSpellName(24732)]	= true, -- Bat Costume
	[GetSpellName(24735)]	= true, -- Ghost Costume female
	[GetSpellName(24736)]	= true, -- Ghost Costume male
	[GetSpellName(44185)]	= true, -- Jack-o'-Lanterned!
	[GetSpellName(58493)]	= true, -- Mohawked! (69285)
	[GetSpellName(24708)]	= true, -- Pirate Costume female
	[GetSpellName(24709)]	= true, -- Pirate Costume male
	[GetSpellName(61716)]	= true, -- Rabbit Costume
	[GetSpellName(24723)]	= true, -- Skeleton Costume
	[GetSpellName(61781)]	= true, -- Turkey Feathers
	[GetSpellName(24740)]	= true, -- Wisp Costume
	[GetSpellName(24712)]	= true,	-- Leper Gnome Costume
	[GetSpellName(24710)]	= true,	-- Ninja Costume
	[GetSpellName(61781)]	= true,	-- Turkey Feathers
--	[GetSpellName(61734)]	= true	-- Noblegarden Bunny
	[GetSpellName(114800)]	= true, -- Polyformic Acid Potion
}

caelCore.badbuffs:RegisterEvent("UNIT_AURA")
caelCore.badbuffs:SetScript("OnEvent", function(_, _, unit)
	if unit ~= "player" then
		return
	end

	if not InCombatLockdown() then
		for buff, enabled in next, badBuffsList do
			if UnitAura(unit, buff) and enabled then
				CancelUnitBuff(unit, buff)
				print("|cffD7BEA5cael|rCore: removed "..buff)
			end
		end
	end
end)